package com.parking.status.sync.repository;

import com.parking.status.sync.entity.CommandBase;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by Administrator on 2015/9/28.
 */
public interface CommandBaseRepository<T extends CommandBase> extends JpaRepository<T, Long> {

    @Query("select s from #{#entityName} s where s.status=0")
    <S extends T> List<S> findStatusEqualZero();

    @Modifying
    @Query("update #{#entityName} set status=1 where sqo=?1")
    int updateStatus(int sqo);
}
